import Vue from "vue";
import VueRouter from "vue-router";
import Manager from "../views/Manager.vue";
import Home from "../views/Home.vue";
import News from "../views/News.vue";
import Dynamic from "../views/Dynamic.vue";
import User from "../views/user/User.vue";
import Setting from "../views/setting.vue";
import AccountAndSafe from "../views/setting/AccountAndSafe.vue";
import About from "../views/setting/About.vue";
import Login from "../views/login/login.vue";
import NoticeSetting from "../views/setting/NoticeSetting.vue";
import Regist from "../views/login/regist.vue";
import PersonPage from "../views/user/PersonPage.vue";
import infoSearch from "../views/movie/infoSearch.vue";
import writeDy from "../views/dynamic/writeDy.vue";
import detail from "../views/dynamic/detail.vue";
import myPublished from "../views/user/myPublished.vue";
import myComment from "../views/user/myComment.vue";
import myFriends from "../views/user/myFriends.vue";
import newsDetail from "../views/news/newsDetail.vue";
import writeMovieComment from "../views/movie/writeMovieComment.vue";
import myCollection from "../views/user/myCollection.vue";
Vue.use(VueRouter);
// const originalPush = VueRouter.prototype.push
//    VueRouter.prototype.push = function push(location) {
//    return originalPush.call(this, location).catch(err => err)
// }
const routes = [
  {
    path: "/",
    name: "Manager",
    component: Manager,
    children: [
      {
        path: "User",
        component: User,
      },
      {
        path: "News",
        component: News,
      },
      {
        path: "",
        component: Home,
      },
      {
        path: "Dynamic",
        component: Dynamic,
      },
    ],
  },
  {
    path: "/Setting",
    name: "Setting",
    component: Setting,
  },
  {
    path: "/Login",
    name: "Login",
    component: Login,
  },
  {
    path: "/AccountAndSafe",
    name: "AccountAndSafe",
    component: AccountAndSafe,
  },
  {
    path: "/About",
    name: "About",
    component: About,
  },
  {
    path: "/NoticeSetting",
    name: "NoticeSetting",
    component: NoticeSetting,
  },
  {
    path: "/Regist",
    name: "Regist",
    component: Regist,
  },
  {
    path: "/PersonPage",
    name: "PersonPage",
    component: PersonPage,
  },
  {
    path: "/infoSearch",
    name: "infoSearch",
    component: infoSearch,
  },
  {
    path: "/writeDy",
    name: "writeDy",
    component: writeDy,
  },
  {
    path: "/detail",
    name: "detail",
    component: detail,
  },
  {
    path: "/myPublished",
    name: "myPublished",
    component: myPublished,
  },
  {
    path: "/myComment",
    name: "myComment",
    component: myComment,
  },
  {
    path: "/myFriends",
    name: "myFriends",
    component: myFriends,
  },
  {
    path: "/newsDetail",
    name: "newsDetail",
    component: newsDetail,
  },
  {
    path: "/writeMovieComment",
    name: "writeMovieComment",
    component: writeMovieComment,
  },
  {
    path: "/myCollection",
    name: "myCollection",
    component: myCollection,
  },
];

const router = new VueRouter({
  routes,
});

export default router;
